/*
day191
2020.3.6
*/
#include<map>
#include<set>
#include<string>
#include<vector>
#include<sstream>
using namespace std;

class Solution {
public:
    string mostCommonWord(string paragraph, vector<string>& banned) {
		stringstream stream(paragraph);
		map<string,int> m;
		set<string> s;
		string res;
		int max=0;
		for(const string &str:banned)
		{
			s.insert(str);
		}
		
		string tem;
		while(stream>>tem)
		{
			char ba=tem.back();
			 
			if(   !(  (ba>='A' && ba<='Z') || (ba>='a' && ba<='z')  )    )
			{
				tem.pop_back();
			}
			for(auto iter=tem.begin();iter!=tem.end();iter++)
			{
				if((*iter)>='A' && (*iter)<='Z')
				{
					(*iter)+=32;
				}
			}
			if(s.find(tem) == s.end())
			{
				m[tem]++;
				if(m[tem]>max)
				{
					res=tem;
					max=m[tem];
				}
			}
		}
		
		return res;
    }
};

int main()
{
	return 0;
}
